<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>统战成员学习平台</title>
    <link rel="stylesheet" type="text/css" href="../css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../css/discovery.css"/>
</head>

<body>
<div id='app' style="display:none" v-show="true">
    <div class="user_form">
        <div class="header-item">
            <!-- <div class="item right">
                <i class="icon icon_xh"></i> 学号/职工号
                </span>
            </div> -->
            <div class="item right" @click="openWin(isLogin ? './me/point_win' : 'login')">
                <i class="icon icon_wdjf"></i> 我的积分
                <span class="point-num">{{userInfo.experienceScore}}分</span>
            </div>
            <div class="item ui_border_t right" @click="openWin(isLogin ? './me/my_moments_win' : 'login')">
                <i class="icon icon_wdzy"></i> 我的主页
                <span></span>
            </div>
            <div class="item ui_border_t right" @click="openWin(isLogin ? './me/my_discovery_win' : 'login')">
                <i class="icon icon_ywxg"></i> 与我相关
                <span></span>
            </div>
        </div>
        <!-- <div class="item-group">
            <div class="item ui_border_t right">
                <i class="icon icon_qd"></i> 会议签到
                <span></span>
            </div>
        </div> -->
        <!--			<div class="item-group">-->
        <!--				<div class="item ui_border_t right" @click="tmp_msg()">-->
        <!--					<i class="icon icon_jfdh"></i> 积分兑换-->
        <!--					<span></span>-->
        <!--				</div>-->
        <!--			</div>-->

        <div class="item-group">
            <!--				<div class="item ui_border_t right" @click="openWin('./me/about_win')">-->
            <!--					<i class="icon icon_about"></i> 关于统战成员学习平台-->
            <!--					<span></span>-->
            <!--				</div>-->
            <!--				<div class="item ui_border_t right" @click="openWin('./me/more_win')">-->
            <!--					<i class="icon icon_more"></i> 更多-->
            <!--					<span></span>-->
            <!--				</div>-->
            <div class="item ui_border_t right" @click="openWin('./me/watchHis_win')">
                <i class="icon icon_gkls"></i> 观看历史
                <span></span>
            </div>
            <div class="item ui_border_t right" @click="openWin('./me/collect_win')">
                <i class="icon icon_wdsc"></i> 我的收藏
                <span></span>
            </div>
            <div class="item ui_border_t right" @click="openWin('./me/mycomments_win')">
                <i class="icon icon_wdpl"></i> 我的评论
                <span></span>
            </div>
        </div>
        <div class="item-group">
            <div class="item ui_border_t right" @click="openWin('./me/feedback_win')">
                <i class="icon icon_zjhh"></i> 意见反馈
                <span></span>
            </div>
        </div>
        <div class="btn-wrap" @click="logout()">
            <div class="btn logout">退出登录</div>
        </div>
    </div>
</div>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/vue.min.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/layer_mobile/layer.js"></script>
<script type="text/javascript">
    new Vue({
        el: '#app',
        data: {
            height: 'auto',
            imageBasePath: imageBasePath,
            userInfo: {},
            isLogin: isLogin(),
            apiready: false,
            // <span v-if="isLogin && msgCount>0" class="num">{{msgCount}}</span>
            // msgCount: 0
        },
        mounted: function () {
            var $this = this;
            apiready = function () {
                api.parseTapmode();
                $this.apiready = true;
                $this.init();
                $this.addEventListener();

                // api.addEventListener({
                //     name: 'refresh_newmessagecount_event'
                // }, function(ret, err){
                // 	if($this.isLogin) {
                // 		$this.newMsgCount();
                // 	}
                // });
            }
        },
        methods: {
            init: function () {
                api.parseTapmode();
                var $this = this;
                // var header = $api.dom('header');
                // $api.fixStatusBar(header);
                // $this.height = api.frameHeight - $api.offset(header).h + 'px';
                var userInfo = $api.getStorage(_.USERINFO);
                $this.userInfo = userInfo || {};
                $this.isLogin = !!userInfo;
                // if($this.isLogin){
                // 	$this.newMsgCount()
                // }
                // api.setFrameAttr({
                // 	name: api.frameName,
                // 	hidden: true
                // });
                // remove LaunchView when last frame loaded

                api.setFrameAttr({
                    name: api.frameName,
                    hidden: true
                });
            },
            newMsgCount: function () {
                var $this = this;
                post('/client/studyMoment/newMsgCount', {}, function (ret) {
                    if (ret.isSuccess) {
                        $this.msgCount = ret.data
                    }
                })
            },
            addEventListener: function () {
                var $this = this;
                api.addEventListener({
                    name: 'user_login_logout_event'
                }, function (ret, err) {
                    var userInfo = $api.getStorage(_.USERINFO);
                    $this.userInfo = userInfo || {};
                    $this.isLogin = !!userInfo;
                });
                api.addEventListener({
                    name: 'refresh_userInfo_event'
                }, function (ret, err) {
                    $this.refreshUserInfo();
                });

                api.addEventListener({
                    name: 'open_my_zone_event'
                }, function (ret, err) {
                    api.setFrameAttr({
                        name: api.frameName,
                        hidden: false
                    });
                    $this.refreshUserInfo();
                });
                api.addEventListener({
                    name: 'hide_my_zone_event'
                }, function (ret, err) {
                    api.setFrameAttr({
                        name: api.frameName,
                        hidden: true
                    });
                });
            },
            logout: function () {
                api.sendEvent({
                    name: EVENT.LOGOUT_EVENT
                });
            },
            tmp_msg() {
                msgUtil.toast({
                    msg: '敬请期待...'
                });
            },
            refreshUserInfo: function () {
                var $this = this;
                post('/client/user/selectMyInfo', {}, function (ret) {
                    if (ret.isSuccess) {
                        updateStorageUserInfo(ret.data);
                        $this.userInfo = $api.getStorage(_.USERINFO) || {};
                    }
                });
            }
        }
    });
</script>
</body>

</html>
